-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for exporting to YAML format #7007
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some nitpicks remaining. The empty line fix should have gone in a separate PR as discussions on regular expressions typically take more time. Let's see if it goes well, here.
Could you also add a test case for the example at #6974? I think, there could be issues at the date export. - Maybe good for a follow-jup PR?
@@ -278,8 +269,12 @@ public void export(final BibDatabaseContext databaseContext, final Path file, | |||
// Write the entry | |||
if (layout != null) { | |||
if (deleteBlankLines) { | |||
String withoutBlankLines = BLANK_LINE_MATCHER.matcher(layout.doLayout(entry, databaseContext.getDatabase())).replaceAll(""); | |||
ps.write(withoutBlankLines); | |||
String[] lines = layout.doLayout(entry, databaseContext.getDatabase()).split("\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double check: Does this work on Windows and Linux equally well? Mayybe OS.NEW_LINE
should be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative implementation could have been to update the regular expression. I am really not sure why it stopped working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly enough when using OS.NEW_LINE
on Windows its breaks.
need to do an test on linux though, currently having problems running my vm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should check both? We don't know which line endings the user has in the template files (if modified)
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
Co-authored-by: Oliver Kopp <kopp.dev@gmail.com>
I see the unit tests failing:
Could you please check what's going wrong there? |
I already fixed that issue in my local branch, currently testing the blank line deletion. |
fixed blank line removal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got three nitpicks.
Thanks for the good work so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for delay. Hope, you are still in the context. I have some micro comments...
package org.jabref.logic.exporter; | ||
|
||
/** | ||
this enum represents the behaviour for blank lines in {@link TemplateExporter} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full JavaDoc 😇
this enum represents the behaviour for blank lines in {@link TemplateExporter} | |
* This enum represents the behaviour for blank lines in {@link TemplateExporter} |
private static final String LAYOUT_EXTENSION = ".layout"; | ||
private static final String FORMATTERS_EXTENSION = ".formatters"; | ||
private static final String BEGIN_INFIX = ".begin"; | ||
private static final String END_INFIX = ".end"; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not add two empty lines - I wonder why checkstyle did not complain
@Override | ||
public String format(String value) { | ||
Map<String, String> map = Map.of(StandardEntryType.Article.getDisplayName(), "article", | ||
StandardEntryType.Book.getDisplayName(), "book", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple switch was not possible
return switch(value) {
case StandardEntryType.Article.getDisplayName() -> "article",
...
case StandardEntryType.Conference.getDisplayName() -> "paper-conference",
...
default -> "no-type";
}
Thank you for the patience @joethei |
Support for exporting to YAML , fixes Alternative serialization format as core data file (e.g. YAML in addition to BibTeX) #6974
Fixed deleteBlankLines parameter in TemplateExporter not working.
Enabled deleteBlankLines for the RIS Exporter, which used to have that enabled.
Change in CHANGELOG.md described (if applicable)
Tests created for changes (if applicable)
Manually tested changed features in running JabRef (always required)
Screenshots added in PR description (for UI changes)
Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.